import { PageContainer } from '@/component/page-container';
import { Breadcrumb, Space, Radio, Card } from 'antd';
import React, { useState } from 'react';
import NoReview from './noreview';
import Review from './review';
import Initiate from './initiate';

const ComponentMap: Record<string, React.ComponentType> = {
  noreview: NoReview,
  review: Review,
  initiate: Initiate,
};

const Group = () => {
  // 待审核、已审核、我发起
  const [position, setPosition] = useState<'noreview' | 'review' | 'initiate'>('noreview');
  const Component = ComponentMap[position];

  return (
    <PageContainer header={<Breadcrumb items={[{ title: '审核管理' }]} />}>
      <Card>
        <Space>
          <Radio.Group value={position} onChange={e => setPosition(e.target.value)}>
            <Radio.Button value="noreview">待审核</Radio.Button>
            <Radio.Button value="review">已审核</Radio.Button>
            <Radio.Button value="initiate">我发出</Radio.Button>
          </Radio.Group>
        </Space>
        <div style={{ marginTop: 20 }}>
          <Component />
        </div>
      </Card>
    </PageContainer>
  );
};

export default Group;
